﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MuYue.ORM;

namespace Mrsoft.AutoStarter
{
    class Account
    {

        #region 账号数据信息
        public string charaterName { set; get; }
        public string username { set; get; }
        public string password { set; get; }
        public string serverArea { set; get; }
        public string serverName { set; get; }
        public DateTime LastOnLineTime { set; get; }
        /// <summary>
        /// 是否在使用
        /// </summary>
        public bool shouldCheck { set; get; }
        public string mbId { set; get; }
        #endregion

        #region 账号数据操作方法
        public bool Insert()
        {
            return FastDb.Add(this);
        }

        public bool Delete()
        {
            return FastDb.Delete(this, "username") > 0;
        }

        public bool Update()
        {
            return FastDb.Update(this, "username");
        }

        public bool SetMibaoka(string mbId)
        {
            this.mbId = mbId;
            return Update();
        }

        public static List<Account> GetAccList()
        {
            return FastDb.GetAll<Account>("1");
        }
        #endregion
    }
}
